package com.hsh.async;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * <p></p>
 *
 * @author huangsihai
 * @date 8/28/2021
 */
public class AsyncThreadPool {

    public static final ExecutorService cachedThreadPool = Executors.newCachedThreadPool();

    /**
     * 延迟执行线程池
     * 使用场景： 延时删除PDF转换工具中的临时文件
     * 执行时: 指定延时执行的时间间隔
     * scheduledThreadPool.schedule(() -> {...}, 10, TimeUnit.SECONDS);//延迟10秒执行...
     */
    public static final ScheduledExecutorService scheduledThreadPool = Executors.newSingleThreadScheduledExecutor();
}
